<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改管理员账户</title>
<#assign base=request.contextPath  />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${base}/frame/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${base}/css/demo.css" type="text/css">
    <script src="${base}/js/jquery.min.js"></script>
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <style type="text/css">
        form {
            padding: 20px;
        }

        .layui-btn-radius {
            border-radius: 5px;
        }
    </style>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend>修改管理员账户</legend>
</fieldset>
<label class="layui-form-label">账号</label>
<div class="layui-input-block">
    <input id="account" type="text" name="title" lay-verify="title" autocomplete="off" placeholder="${user.account}" class="layui-input">
</div>
<label class="layui-form-label">密码</label>
<div class="layui-input-block">
    <input id="pass" type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入新的密码" class="layui-input">
</div>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <button type="button" class="layui-btn layui-btn-fluid" onclick="updateUser()">确定修改</button>

</fieldset>

<script src="${base}/frame/layui/layui.js"></script>
<script>

    function updateUser( ){
        if($("#account").val()==null||$("#account").val()==""){
            alert("请输入账户")
            return;
        }
        if($("#pass").val()==null||$("#pass").val()==""){
            alert("请输入密码")
            return;
        }
        $.ajax({
            type: "get",
            url:  "${base}/admin/updateAdmin",
            async:false,
            data: {
                account:$("#account").val(),
                pass:$("#pass").val()
            },
            success: function(data) {
                    if(data===true){
                        alert("修改成功")
                       window.location.href="${base}/admin";
                    }else{
                        alert("失败")
                    }
            }
        });
    }
</script>
</body>
</html>